<template>
    <div class="login">
      <el-form :rules="rules" ref="registerForm" :model="registerForm" class="loginContainer">
        <h3 class="loginTitle">邮箱登录</h3>
        <el-form-item prop="username">
          <el-input type="email" auto-complete="false" v-model="registerForm.username" placeholder="请输入用户名"></el-input>
        </el-form-item>
        <el-form-item prop="password">
          <el-input type="password" auto-complete="false" v-model="registerForm.password" placeholder="请输入密码"></el-input>
        </el-form-item>
        <el-form-item>
          <span class="logintext" @click="login"><a>手机号登录</a></span>
        </el-form-item>
        <el-button type="primary" colorst="width:100%" @click="goto">登录</el-button>
      </el-form>
    </div> 
  </template>
  
  <script>
  export default {
    name: "login",
    data(){
      return{
        /* 注册用户表单信息 */
        registerForm:{
          username:'1121564@qq.com',
          password:'12313',
          inpassword:''
        },
        /* 注册用户表单验证规则 */
        rules:{
          username: [{required:true,message:'请输入邮箱',trigger:'blur'}],
          password: [{required:true,message:'请输入的密码',trigger:'blur'}],
          // inpassword: [{required:true,message:'请再次输入密码',trigger:'blur'}],
        }
      }
    },
    methods:{
      /* 登录组件跳转 */
      login(){
        this.$router.push('/')
      },
      /* 注册用户功能 */
      goto(){
        /* 注册成功的消息弹窗 */
        this.$message({
          message: '恭喜你，登录成功',
          type: 'success'
        });
        this.$router.push('/shop')
      }
    }
  }
  </script>
  
  <style scoped>
  .login{
    display: flex;
    justify-content: center;
    align-items: center;
    height: 790px;
    background-image: url("../img/1.jpg");
    background-image: url("../img/1.jpg");
    background-size: cover;
    margin-top: -50px;
  }
  .loginContainer{
    border-radius: 15px;
    background-clip: padding-box;
    opacity: 0.9;
    width: 350px;
    padding: 15px 35px 15px 35px;
    background: #fff;
    border: 1px solid #eaeaea;
    box-shadow: 0 0 25px #cac6c6;
    opacity: 0.75;
  }
  .loginTitle{
    margin: 0 auto 40px auto;
    text-align: center;
  }
  .logintext{
    float: right;
    color: #f593a2;
    text-decoration-line: none;
    cursor: pointer
  }
  </style>
  